<!doctype html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <title>原司法厅指定司法所页面</title>
    <script src="/webjars/miniui/boot.js" type="text/javascript"></script>
    <link href="/static/css/resource.css" rel="stylesheet" type="text/css" />
    <script src="/static/js/common/common.js" type="text/javascript"></script>
    <link href="/webjars/miniui/css/demo.css" rel="stylesheet" type="text/css" />
    <link href="/static/css/default.css" rel="stylesheet" type="text/css" />
    <link href="/static/css/voiceinteraction/voiceinteraction.css" rel="stylesheet" type="text/css" />
    <style>
        .discell {
            text-align:right;
            width:30%;
        }
        .input {
            width:70%;
        }
        table {
            border-collapse:separate;
            border-spacing:10px;
        }
    </style>
</head>
<body>
<div class="mini-fit" style="margin-bottom: 40px;">
    <form id="form1" method="post" style="height:100%;width: 100%;overflow-x: auto;overflow-y: auto;">
        <!-- 用户 编辑框START-->
        <div id="editform" class="form" style="padding:10px;">
            <input name="id" id="id" class="mini-hidden" style="width: 100%;" readonly value="${resultMap.id!''}" />
            <input name="priNum" id="priNum" class="mini-hidden" style="width: 100%" readonly value="${resultMap.priNum!''}" />
            <table class="form-table" align="center">
                <tr>
                    <td style="font-weight: bold;text-align: left">服刑人员信息:</td>
                </tr>
                <tr>
                    <td class="discell">服刑人员姓名:</td>
                    <td class="input">
                        <input name="pname" id="pname" class="mini-textbox" value="${resultMap.pname!''}" style="width: 100%"
                               readonly />
                    </td>
                </tr>
                <tr>
                    <td class="discell">服刑人员户籍地址:</td>
                    <td class="input">
                        <input name="hjdz" id="hjdz" class="mini-textbox" value="${resultMap.hjdz!''}" style="width: 100%"
                               readonly />
                    </td>
                </tr>
                <tr>
                    <td class="discell">服刑人员服刑单位:</td>
                    <td class="input">
                        <input name="fxdw" id="fxdw" class="mini-textbox" value="${resultMap.fxdw!''}" style="width: 100%"
                               readonly />
                    </td>
                </tr>
                <tr>
                    <td class="discell">服刑人员释放时间:</td>
                    <td class="input">
                        <input name="sfsj" id="sfsj" class="mini-textbox" value="${resultMap.sfsj!''}" style="width: 100%"
                               readonly />
                    </td>
                </tr>
                <tr>
                    <td class="discell">附件信息:</td>
                    <td class="input">
                        <input type="button" onclick="onFileUpload()" value="上传" style="width: 150px" />
                    </td>
                </tr>
                <tr>
                    <td style="font-weight: bold;text-align: left">监狱局信息:</td>
                </tr>
                <tr>
                    <td class="discell">监狱意见:</td>
                    <td class="input">
                        <input name="jyyj" id="jyyj" class="mini-textarea" value="${resultMap.jyyj!''}" style="width: 100%;height: 100px" readonly
                               style="width: 100%" />
                    </td>
                </tr>
                <tr>
                    <td style="font-weight: bold;text-align: left">监狱局信息:</td>
                </tr>
                <tr>
                    <td class="discell">监狱局意见:</td>
                    <td class="input">
                        <input name="jyjyj" id="jyjyj" class="mini-textarea" value="${resultMap.jyjyj!''}" style="width: 100%;height: 100px" readonly
                               style="width: 100%" />
                    </td>
                </tr>
                <tr>
                    <td style="font-weight: bold;text-align: left">上报司法厅信息:</td>
                </tr>
                <tr>
                    <td class="discell">名称:</td>
                    <td class="input">
                        <input name="sftmc" id="sftmc" class="mini-textbox" value="${resultMap.sftmc!''}" readonly style="width: 100%"
                               emptyText="" />
                    </td>
                </tr>
                <tr>
                    <td class="discell">联系人:</td>
                    <td class="input">
                        <input name="sftlxr" id="sftlxr" class="mini-textbox" value="${resultMap.sftlxr!''}" readonly style="width: 100%"
                               emptyText="联系人" />
                    </td>
                </tr>
                <tr>
                    <td class="discell">联系方式:</td>
                    <td class="input">
                        <input name="sftphone" id="sftphone" class="mini-textbox" value="${resultMap.sftphone!''}" readonly style="width: 100%"
                               emptyText="手机号码" />
                    </td>
                </tr>
                <tr>
                    <td class="discell">联系方式:</td>
                    <td class="input">
                        <input name="sfttel" id="sfttel" class="mini-textbox" value="${resultMap.sfttel!''}" readonly style="width: 100%"
                               emptyText="固定电话(区号-区段号码)" />
                    </td>
                </tr>
                <tr>
                    <td class="discell">意见:</td>
                    <td class="input">
                        <input name="sftyj" id="sftyj" class="mini-textarea" value="${resultMap.sftyj!''}" style="width: 100%;height: 100px" readonly
                               style="width: 100%" />
                    </td>
                </tr>
                <tr>
                    <td style="font-weight: bold;text-align: left">司法部信息:</td>
                </tr>
                <tr>
                    <td class="discell">司法部意见:</td>
                    <td class="input">
                        <input name="sfbyj" id="sfbyj" class="mini-textarea" value="${resultMap.sfbyj!''}" style="width: 100%;height: 100px"
                               readonly />
                    </td>
                </tr>
                <tr>
                    <td class="discell">抄送单位:</td>
                    <td colspan="3">
                        <input name="csdw" id="csdw" value="${resultMap.dssftDepartid!''}" class="mini-combobox" style="width: 100%" readonly
                               textField="codeName" valueField="codeId" emptyText="请选择..."
                               url="/azbj/ksywxt/getDepartmentCoordinate?1=1&dssftDepartid=${resultMap.dssftDepartid!''}"
                        />
                    </td>
                </tr>
                <tr>
                    <td style="font-weight: bold;text-align: left">协调司法厅信息:</td>
                </tr>
                <tr>
                    <td class="discell">名称:</td>
                    <td class="input">
                        <input name="dssftName" id="dssftName" class="mini-textbox" value="${resultMap.dssftName!''}" readonly style="width: 100%"
                               emptyText="" />
                    </td>
                </tr>
                <tr>
                    <td class="discell">联系人:</td>
                    <td class="input">
                        <input name="dssftlxr" id="dssftlxr" class="mini-textbox" value="${resultMap.dssftlxr!''}" readonly style="width: 100%"
                               emptyText="联系人" />
                    </td>
                </tr>
                <tr>
                    <td class="discell">联系方式:</td>
                    <td class="input">
                        <input name="dssftphone" id="dssftphone" class="mini-textbox" value="${resultMap.dssftphone!''}" readonly style="width: 100%"
                               emptyText="手机号码" />
                    </td>
                </tr>
                <tr>
                    <td class="discell">联系方式:</td>
                    <td class="input">
                        <input name="dssfttel" id="dssfttel" class="mini-textbox" value="${resultMap.dssfttel!''}" readonly style="width: 100%"
                               emptyText="固定电话(区号-区段号码)" />
                    </td>
                </tr>
                <tr>
                    <td class="discell">意见:</td>
                    <td class="input">
                        <input name="dssftRefuse" id="dssftRefuse" class="mini-textarea" value="${resultMap.dssftRefuse!''}"
                               style="width: 100%;height: 100px" readonly style="width: 100%" />
                    </td>
                </tr>
                <tr>
                    <td style="font-weight: bold;text-align: left">司法部协调信息:</td>
                </tr>
                <tr>
                    <td class="discell">司法部协调后意见:</td>
                    <td class="input">
                        <input name="sfbyjRefuse" id="sfbyjRefuse" class="mini-textarea" value="${resultMap.sfbyjRefuse!''}"
                               style="width: 100%;height: 100px" readonly style="width: 100%;height: 100px" />
                    </td>
                </tr>
                <tr>
                    <td style="font-weight: bold;text-align: left">指定本省司法所:</td>
                </tr>
                <tr id="sfsinfo">
                    <td class="discell">
                        指定司法所地址:
                    </td>
                    <td class="input">
                        <input id="nativepro" name="nativepro" class="mini-combobox" required="true" emptyText="省份"
                               textfield="codeName" valueField="codeId" style="width: 100%"
                               onclick="onDeptChanged('nativepro')" onvaluechanged="onValueChanged('nativepro')" />
                        <input id="nativecity" name="nativecity" class="mini-combobox" required="true" emptyText="市"
                               textfield="codeName" valueField="codeId" onclick="onDeptChanged('nativecity')" style="width: 100%"
                               onvaluechanged="onValueChanged('nativecity')" />
                        <input id="nativecou" name="nativecou" class="mini-combobox" required="true" emptyText="县"
                               textfield="codeName" valueField="codeId" onclick="onDeptChanged('nativecou')" style="width: 100%"
                               onvaluechanged="onValueChanged('nativecou')" />
                        <input id="nativevill" name="nativevill" class="mini-combobox" emptyText="街道" style="width: 100%"
                               textfield="codeName" valueField="codeId"onclick="onDeptChanged('nativevill')" required="true" />
                    </td>
                </tr>
            </table>
        </div>
    </form>
</div>
<div style="position: absolute;bottom: 0;line-height:40px;width: 100%;border-top:1px solid #dfdfdf;text-align: center">
    <a class="mini-button" iconCls="fa-save" plain="true" onclick="saveData()" style="font-size: 15px">处理</a>
    <a class="mini-button" iconCls="fa-close" plain="true" onclick="onCancel()">取消</a>
</div>

<script type="text/javascript">
    mini.parse();
    var form = new mini.Form("form1");
    var nativepro = mini.get("nativepro");
    var nativecity = mini.get("nativecity");
    var nativecou = mini.get("nativecou");
    var nativevill = mini.get("nativevill");

    /**
     * 保存数据
     */
    function saveData() {
        form.validate();
        if (form.isValid() == false) {
            return;
        }
        var data = form.getData();
        var json = mini.encode(data);
        $.ajax({
            url: "/azbj/ksywxt/dealOrigin/save",
            data: {data: json},
            type: "post",
            success: function (success) {
                if (success.code == 1) {
                    mini.alert("保存成功", "成功", window.CloseOwnerWindow);
                } else if (success.code == 5599) {
                    mini.alert(success.message);
                } else {
                    mini.alert("保存失败");
                }
            }, error: function () {
                mini.unmask(document.body);
                mini.alert("系统异常");
            }
        })
    }

    // 衔接失败上传附件
    function onFileUpload() {//taskId为35是衔接信息的附件
        commonEdit("/upload/user/uploadAppendixfileWork/view?1=1&id=${resultMap.xjxxId!''}&priNum=${resultMap.priNum!''}&taskId=35", null, null, 600, 400, true, true, true);
    }

    var urltemp = "/azbj/getCodeDetail/?codeType=2_1&codeId=-2";
    function onDeptChanged(e) {
        if ("nativepro" == e) {
            nativepro.setData([{codeId: "${provinceCode!''}", codeName: "${provinceName!''}"}]);
            nativepro.select(0);
        }
        if ("nativecity" == e) {
            var value = nativecity.getValue();
            if (nativepro.getValue() == "") {
                nativepro.setUrl(urltemp);
                nativepro.setValue("");
                nativecou.setUrl(urltemp);
                nativecou.setValue("");
                nativevill.setUrl(urltemp);
                nativevill.setValue("");
            }
            var codeId = nativepro.getValue();
            nativecity.setValue("");
            var url = "/azbj/getCodeDetail/?codeType=2_1&codeId=" + codeId;
            nativecity.setUrl(url);
            if (value != '') {
                nativecity.setValue(value);
            } else {
                nativecity.select(0);
            }
        }

        if ("nativecou" == e) {
            var value = nativecou.getValue();
            if (nativecity.getValue() == "") {
                nativecou.setUrl(urltemp);
                nativecou.setValue("");
                nativevill.setUrl(urltemp);
                nativevill.setValue("");
                return;
            }
            var codeId = nativecity.getValue();
            nativecou.setValue("");
            var url = "/azbj/getCodeDetail/?codeType=2_1&codeId=" + codeId;
            nativecou.setUrl(url);
            if (value != '') {
                nativecou.setValue(value);
            } else {
                nativecou.select(0);
            }
        }

        if ("nativevill" == e) {
            var value = nativevill.getValue();
            if (nativecou.getValue() == "") {
                nativevill.setUrl(urltemp);
                nativevill.setValue("");
                return;
            }
            var parent_code = nativecou.getValue();
            nativevill.setValue("");
            var url = "/azbj/getCodeDetail?codeType=2_1&codeId=" + parent_code;
            nativevill.setUrl(url);
            if (value != '') {
                nativevill.setValue(value);
            } else {
                nativevill.select(0);
            }
        }
    }

    function onValueChanged(e) {
        if ("nativepro" == e) {
            nativecity.setValue("");
            nativecou.setValue("");
            nativevill.setValue("");
        }
        if ("nativecity" == e) {
            nativecou.setValue("");
            nativevill.setValue("");
        }
        if ("nativecou" == e) {
            nativevill.setValue("");
        }
    }
</script>
</body>
</html>